package edzis.translatebuddy
{
	import edzis.translatebuddy.control.command.*;
	import edzis.translatebuddy.model.AppProxy;
	import edzis.translatebuddy.model.DataProxy;
	import org.puremvc.as3.multicore.interfaces.IFacade;
	import org.puremvc.as3.multicore.patterns.facade.Facade;
	import org.puremvc.as3.multicore.patterns.observer.Notification;	

	public class ApplicationFacade extends Facade implements IFacade
	{

		public static const APP_STARTUP:String = "AppStartUp";	
		
		
		public function ApplicationFacade(pKey:String) {
			super(pKey);
		}
		
		public static function getInstance(pKey:String):ApplicationFacade {
            if (instanceMap[pKey] == null)
				instanceMap[pKey] = new ApplicationFacade(pKey);
            return instanceMap[pKey] as ApplicationFacade;
		}	
		
		override protected function initializeController():void {
			super.initializeController();

			registerCommand(APP_STARTUP, StartUpCommand);
			
			
		}
		
		override protected function initializeModel():void {
			super.initializeModel();
			
			registerProxy(new AppProxy());
			registerProxy(new DataProxy());
		}

		public function startup( app:TranslateBuddy ):void {			
			sendNotification( ApplicationFacade.APP_STARTUP, app ) ;
		}
		
	}
}